# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=osv-scanner
pkgver=1.4.3
pkgrel=1
pkgdesc="Vulnerability scanner written in Go which uses the data provided by https://osv.dev"
url='https://github.com/google/osv-scanner'
arch=('loong64' 'x86_64')
license=('Apache-2.0')
makedepends=('go')
source=(https://github.com/google/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('a32daca1d28374b7f63174467bb72783b3f478aed8d260263aa88056271b7f21')
b2sums=('bb28e5feda55071f8e7a75146b4ac6ed0ae0c408454db366c2d6df2ae64d9806b3cbd87df6bce7786d5c5ca8741b9eec1bba3e6121f6938c1755b05800a1a206')

build() {
  cd ${pkgname}-${pkgver}
  go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
    ./cmd/osv-scanner
}

check() {
  cd ${pkgname}-${pkgver}
  ./osv-scanner --help
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 -t "${pkgdir}/usr/bin" \
    osv-scanner
}

# vim: ts=2 sw=2 et:
